package com.course.config;

import android.widget.TextView;

import com.course.android.NewApplication;
import com.course.android.R;

import org.apache.commons.lang.StringUtils;

public class UrlConfig {
    static UrlConfig instance;

    public static UrlConfig getInstance() {
        if (instance == null) {
            instance = new UrlConfig();
        }
        return instance;
    }

    static boolean pro;


    public boolean isPro() {
        return pro;
    }

    public void setPro(boolean pro) {
        this.pro = pro;
    }

    public static String getUrl() {
        if (pro) {
            return NewApplication.getApp().getResources().getString(R.string.dev_url);
        }

        return NewApplication.getApp().getResources().getString(R.string.dev_url);
    }


    public static String getImageUrl(String url) {
        if (StringUtils.isBlank(url)) {
            return url;
        }
        if (StringUtils.startsWith(url, "http")) {
            return url;
        }
        return getUrl() + "file/img/" + url;
    }
}
